package com.wxk.order.controller;

import com.alibaba.druid.support.json.JSONUtils;
import com.wxk.entity.table.order.Order;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import com.wxk.entity.http.HttpResult;
import com.wxk.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/order")
public class OrderController extends BaseController{
    @Resource
    private IOrderService orderService;

    @Resource
    private DiscoveryClient discoveryClient;

    @Value("${server.port}")
    private String serverPort;

    @GetMapping("getAllOrderList")
    public HttpResult getAllOrderList() {
        List<Order> list=orderService.getAllOrderList();
        for (Order item: list){
            item.setPort(serverPort);
        }
        return HttpResult.success(list);
    }
    @GetMapping("/getOk")
    public HttpResult getOk(){
        return HttpResult.success(serverPort);
    }
}
